home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Programmer Disk
/
The Programmer Disk (Microforum).iso
/
xpro
/
c4
/
pro2
/
1n04039a
< prev
next >
Wrap
Text File
|
1990-07-25
|
385b
|
36 lines
Listing 2
#include <ctype.h>
typedef int bool;
#define FALSE 0
#define TRUE 1
int atoi(const char *s)
{
int n = 0;
bool neg = FALSE;
while (isspace(*s))
++s;
if (*s == '+')
++s;
else if (*s == '-')
{
neg = TRUE;
++s;
}
while (isdigit(*s))
{
n = 10 * n + *s - '0';
++s;
}
if (neg)
n = -n;
return n;
}
----------